package com.yuqian;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.serializer.SimplePropertyPreFilter;
import com.yuqian.Resposoyory.UserRepository;
import com.yuqian.bean.Head;
import com.yuqian.bean.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Set;
import java.util.TreeMap;

/**
 * Created by Administrator on 2017/7/26 0026.
 */

@RestController
public class UserRest {
    Head head=new Head();




        SimplePropertyPreFilter filter=new SimplePropertyPreFilter();
        Set<String> excludes=filter.getExcludes();


    @RequestMapping(value = "/login/{usern}/{psd}/{singletrue}" ,produces = "text/plan;charset=UTF-8")
    public String getUsers(@PathVariable("usern") String username, @PathVariable("psd") String psd, @PathVariable("singletrue") String singletrue){
        TreeMap<String,String> infos=new TreeMap<>();
        infos.put("username",username);
        infos.put("psd",psd);
        StringBuilder sb=new StringBuilder();
        String body=null;
        String json=null;
        excludes.add("password");
        head.setMessage("登录成功");
        head.setRetCode("success");
        String headinfo= JSON.toJSON(head).toString();


       // User user=repository.findUserByUsername(username);
      //  body=JSON.toJSONString(user,filter, SerializerFeature.DisableCircularReferenceDetect);

        json=headinfo+"body:"+body;
        System.out.println(json);
        return json;
    }

}

